import 'package:flutter/material.dart';

import 'request.dart';

void main() {
  HttpRequest.getChatInfo().then((value) {
    for(var e in value) {
      print(e.toString());
    }
  });
  // return runApp(MyApp());
}

class MyApp extends StatelessWidget {
  MyApp({super.key});

  Widget titleSection = Container(
    padding: const EdgeInsets.all(32),
    child: Row(
      children: [
        Expanded(
          child: Column(
            crossAxisAlignment: CrossAxisAlignment.start,
            children: [
              Container(
                padding: const EdgeInsets.only(bottom: 8),
                child: const Text(
                  'Oeschinen Lake Campground',
                  style: TextStyle(
                    fontWeight: FontWeight.bold,
                  ),
                ),
              ),
              Text(
                'Kandersteg, Switzerland',
                style: TextStyle(
                  color: Colors.grey[500],
                ),
              ),
            ],
          ),
        ),
        const Icon(
          Icons.star,
          color: Colors.red,
        ),
        const Text('41')
      ],
    ),
  );

  final List<BottomNavigationBarItem> bottomNavItems = [
    const BottomNavigationBarItem(icon: Icon(Icons.home), label: '主页'),
    const BottomNavigationBarItem(icon: Icon(Icons.people), label: '通讯录'),
    const BottomNavigationBarItem(icon: Icon(Icons.settings), label: '设置')
  ];

  Widget chatBar = Container(
    padding: const EdgeInsets.all(16),
    child: Row(
      children: [
        Container(
          padding: const EdgeInsets.all(5),
          child: const Icon(Icons.people_alt),
        ),
        Container(
          padding: const EdgeInsets.only(left: 10),
          child: const Column(
            crossAxisAlignment: CrossAxisAlignment.start,
            children: [
              Text(
                "textname",
                textAlign: TextAlign.left,
                style: TextStyle(fontWeight: FontWeight.bold),
              ),
              Text("testssasdasdasdasdasdasdsss"),
            ],
          ),
        )
      ],
    ),
  );

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: '首页',
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Flutter layout demo'),
        ),
        body: Column(
          children: [chatBar, chatBar],
        ),
        bottomNavigationBar: BottomNavigationBar(
          items: bottomNavItems,
        ),
      ),
    );
  }
}
